<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: TunecoreDirect::Base</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">TunecoreDirect::Base</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/tunecore_direct/base_rb.html">
                tunecore_direct/base.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                Object
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <h1>TunecoreDirect</h1>
<p>
TunecoreDirect is a REST/XML based web service API that allows Tunecore
partners to &quot;white label&quot; the Tunecore media distribution
platform, letting you offer Tunecore&#8216;s services to your customers
transparently. The web service allows a partner to:
</p>
<ol>
<li>Create/Query customer accounts

</li>
<li>Publish albums that belong to customer accounts

</li>
</ol>
<p>
To get started with the API first obtain an API key, then have a look at
these three class which you will use to interact with TuneCore:
</p>
<ul>
<li><a href="Person.html">Person</a>

</li>
<li><a href="Album.html">Album</a>

</li>
<li><a href="Song.html">Song</a>

</li>
</ul>
<p>
These three classes provide all the functionality you will need to easily
manage your accounts and publish albums through TuneCore. Under the hood
they use the <a href="Request.html">Request</a> and <a
href="Response.html">Response</a> classes to interact with the
TunecoreDirect REST API.
</p>
<hr size="1"></hr><h3>Short Example</h3>
<p>
Set up your environment:
</p>
<pre>
     require 'tunecore_direct'
     TunecoreDirect::Base.tunecore_server = &quot;http://localhost:3000&quot;
     TunecoreDirect::Base.api_key = &quot;57247d992de24d7840a1b75dc2e5c30a&quot;
     request = TunecoreDirect::Request.new
</pre>
<p>
Create a person:
</p>
<pre>
     # Make a new a person object and set all the attributes
     person = TunecoreDirect::Person.new( :name =&gt; &quot;Alex Kane&quot;,
                                         :email =&gt; &quot;alex@gmail.com&quot;,
                                         :phone_number =&gt; &quot;212-555-1212&quot;,
                                         :country =&gt; &quot;United States&quot;,
                                         :postal_code =&gt; &quot;11201&quot; )
     # Create the person on the Tunecore server
     person.create
     =&gt; false
     # Hmm it didn't work.  Let's find out why.
     person.errors
     =&gt; [{:message=&gt;&quot;can't be blank&quot;, :attribute=&gt;&quot;password&quot;}]
     # Doh! We forgot to set a password.
     person.password = &quot;paSSword&quot;
     person.create
     =&gt; true
     # It worked, and we can now get the person_id which we will use later to create albums for this person
     person.person_id
     =&gt; 55342
</pre>
<p>
Get a list of your people:
</p>
<pre>
     response = request.get_people
     response.status
     =&gt; &quot;complete&quot;
     response.type
     =&gt; &quot;people&quot;
     response.object.first.email
     =&gt; &quot;joe1243@blow.com&quot;
</pre>
<table>
<tr><td valign="top">Author:</td><td>Alex Kane (<a href="mailto:alex@tunecore.com">alex@tunecore.com</a>)

</td></tr>
<tr><td valign="top">Copyright:</td><td>Copyright (c) 2008 Tunecore

</td></tr>
<tr><td valign="top">License:</td><td>GNU LPGPL

</td></tr>
</table>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000027">api_key</a>&nbsp;&nbsp;
      <a href="#M000028">api_key</a>&nbsp;&nbsp;
      <a href="#M000026">api_key=</a>&nbsp;&nbsp;
      <a href="#M000029">to_xml</a>&nbsp;&nbsp;
      <a href="#M000025">tunecore_server</a>&nbsp;&nbsp;
      <a href="#M000024">tunecore_server</a>&nbsp;&nbsp;
      <a href="#M000023">tunecore_server=</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">log</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000027" class="method-detail">
        <a name="M000027"></a>

        <div class="method-heading">
          <a href="Base.src/M000027.html" target="Code" class="method-signature"
            onclick="popupCode('Base.src/M000027.html');return false;">
          <span class="method-name">api_key</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000026" class="method-detail">
        <a name="M000026"></a>

        <div class="method-heading">
          <a href="Base.src/M000026.html" target="Code" class="method-signature"
            onclick="popupCode('Base.src/M000026.html');return false;">
          <span class="method-name">api_key=</span><span class="method-args">(key)</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000024" class="method-detail">
        <a name="M000024"></a>

        <div class="method-heading">
          <a href="Base.src/M000024.html" target="Code" class="method-signature"
            onclick="popupCode('Base.src/M000024.html');return false;">
          <span class="method-name">tunecore_server</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000023" class="method-detail">
        <a name="M000023"></a>

        <div class="method-heading">
          <a href="Base.src/M000023.html" target="Code" class="method-signature"
            onclick="popupCode('Base.src/M000023.html');return false;">
          <span class="method-name">tunecore_server=</span><span class="method-args">(uri)</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000028" class="method-detail">
        <a name="M000028"></a>

        <div class="method-heading">
          <a href="Base.src/M000028.html" target="Code" class="method-signature"
            onclick="popupCode('Base.src/M000028.html');return false;">
          <span class="method-name">api_key</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000029" class="method-detail">
        <a name="M000029"></a>

        <div class="method-heading">
          <a href="Base.src/M000029.html" target="Code" class="method-signature"
            onclick="popupCode('Base.src/M000029.html');return false;">
          <span class="method-name">to_xml</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000025" class="method-detail">
        <a name="M000025"></a>

        <div class="method-heading">
          <a href="Base.src/M000025.html" target="Code" class="method-signature"
            onclick="popupCode('Base.src/M000025.html');return false;">
          <span class="method-name">tunecore_server</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>